<?php
/**
 * for nginx http server
 */
error_reporting( E_ALL );
ini_set( 'display_errors', '1' );
//将出错信息输出到一个文本文件
ini_set( 'error_log', __DIR__ . '/logs/php_error_log.txt' );

//定义常量 APP_ROOT web root
define( 'APP_ROOT',  __DIR__ . '/' );
define( 'APP_MODULE',  __DIR__ . '/apps/' );

$di = new \Phalcon\DI\FactoryDefault();

//Registering config
$di->set( 'config', require APP_ROOT . 'config/config.php' );

$loader = new \Phalcon\Loader();
/**
 * We're a registering a set of directories taken from the configuration file
 */

$loader->registerNamespaces( array(
	'libraries' 	=> APP_ROOT . 'libraries/',
	'vos'		=> APP_ROOT . 'vos/',
	'enums'		=> APP_ROOT . 'enums/',
	'listeners'	=> APP_ROOT . 'listeners/',
    'vendors' => APP_ROOT . 'vendors/'
));

$loader->register();


$app = new \Phalcon\Mvc\Application($di);

require APP_ROOT . 'config/services.php';//加载公共services

// Register the installed modules
$app->registerModules( array(
		 'fzq' => 
		array(
            'className' => 'apps\fzq\Module',
            'path' => APP_ROOT . 'apps/fzq/Module.php'
        ),
));

try
{
	echo $app->handle()->getContent();
}
catch ( \Exception $e )
{
	echo $e->getTraceAsString();
}